package com.tc.test.user.controller;

import com.tc.test.user.feign.OrderFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.Collections;

/**
 * @Auther: tianchao
 * @Date: 2021/9/11 00:45
 * @Description:
 */
@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private OrderFeignService orderFeignService;


    @GetMapping("/detail")
    public String getUser(){
        log.info("[用户服务]");
        //String forObject = restTemplate.getForObject("http://test-order/order/detail", String.class);
        String forObject = orderFeignService.detail();
        return "张三"+ forObject;
    }

}
